Routines (alphabetical) > Routines: W > WV_CWT

WV_CWT

Syntax | Return Value | Arguments | Keywords | Reference | Example | Version History | See Also

The WV_CWT function returns the one-dimensional continuous wavelet transform of the input array. The transform is done using a user-inputted wavelet function.

Syntax

Result = WV_CWT(Array, Family, Order [, /DOUBLE] [, DSCALE=scalar] [, NSCALE=scalar] [, /PAD] [, SCALE=variable] [, START_SCALE=scalar])

Return Value

The result is a two-dimensional array of type complex or double complex, containing the continuous wavelet transform of the input Array.

Arguments

Array

A one-dimensional array of length N, of floating-point or complex type.

Family

A scalar string giving the name of the wavelet function to use for the transform.

Order

The order number, or parameter, for the wavelet function given by Family.

Keywords

DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

DSCALE

Set this keyword to a scalar value giving the spacing between scale values, in logarithmic units. The default is 0.25, which gives four subscales within each major scale.

NSCALE

Set this keyword to a scalar value giving the total number of scale values to use for the wavelet transform. The default is [log2(N/START_SCALE)]/DSCALE+1.

PAD

Set this keyword to force Array to be padded with zeroes before computing the transform. Enough zeroes are added to make the total length of Array equal to the next-higher power-of-two greater than 2N. Padding with zeroes prevents wraparound of the Array and speeds up the fast Fourier transform.

Note: Padding with zeroes reduces, but does not eliminate, edge effects caused by the discontinuities at the start and end of the data.

SCALE

Set this keyword to a named variable in which to return the scale values used for the continuous wavelet transform. The SCALE values range from START_SCALE up to START_SCALE·2^[(NSCALE–1)DSCALE].

START_SCALE

Set this keyword to a scalar value giving the starting scale, in non-dimensional units. The default is 2, which gives a starting scale that is twice the spacing between Array elements.

Reference

Torrence and Compo, 1998: A Practical Guide to Wavelet Analysis. Bull. Amer. Meteor. Soc., 79, 61–78.

Example

; Assume we have monthly random data.

n = 500

dt = 1d/12 ; time sampling

seed = 999

data = RANDOMN(seed, n)

time = 1960 + dt*FINDGEN(n)

 

; Compute the wavelet transform and the power.

wave = WV_CWT(data, 'Morlet', 6, /PAD, SCALE=scales)

wavePower = ABS(wave^2)

; Convert scales to time units.

scales *= dt

 

; Contour visualization.

ICONTOUR, wavePower, time, scales, /Y_LOG, YRANGE=[20,0.25], $

   C_VALUE=FINDGEN(7)+1, $

   /FILL, RGB_TABLE=39, $

   YTITLE='Scale (years)', $

   VIEW_TITLE='Wavelet Power'

; Insert a legend.

tool = IGETCURRENT(TOOL=oTool)

void = oTool->DoAction('Operations/Insert/Legend')

Version History

 

5.4

Introduced

See Also

WV_DWTWV_FN_GAUSSIAN, WV_FN_MORLET, WV_FN_PAUL